home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Borland Plateform / Turbo Prolog 2 / EXAMPL60.PRO < prev    next >
Encoding:
Prolog Source  |  1986-04-25  |  681 b   |  23 lines

  1.                  /* Program 60 */
  2. predicates
  3.   wait(char)
  4.   equal(char,char)
  5.   test(string)
  6. goal
  7.   makewindow(3,7,0,"",0,0,25,80),
  8.   makewindow(2,7,7,"Key to press now",2,5,6,70),
  9.   makewindow(1,7,7,"Accepted letters",8,10,10,60),
  10.   Word = "Peter Piper picked a peck of pickled peppers",
  11.   write("Please type :\n\t",Word,"\n\t"),
  12.   time(0,0,0,0),test(Word),
  13.   time(_,_,S,H),
  14.   write("\nYou took ",S," seconds and ",H," hundredths").
  15. clauses
  16.   wait(X):- inkey(Y),equal(X,Y).
  17.   wait(X):- shiftwindow(2),write(X),wait(X).
  18.   test(W):- frontchar(W,Ch,R),wait(Ch),
  19.             shiftwindow(2),write(Ch),test(R).
  20.   test("").
  21.   equal(X,X):-!.
  22.   equal(_,_):-beep,fail.
  23.